package ucm.controller;

import air_cp5620.util.ProcessPassword;
import java.security.NoSuchAlgorithmException;
import javax.swing.JOptionPane;
import ucm.module.UC_ModUserM;

public class UC_ModUserC {
    private String userid = null;
    private String password = null;
    private String rePassword = null;


    public UC_ModUserC(String userid, String passWord, String rePassWord) throws NoSuchAlgorithmException {
        this.userid = userid;
        if (passWord.equals("") || rePassWord.equals("")) {
            JOptionPane.showMessageDialog(null, "password is null!");
        }

        this.password = ProcessPassword.encrypt(passWord);
        this.rePassword = ProcessPassword.encrypt(rePassWord);
    }


    
    public boolean run()
    {
        if (!password.equals(rePassword)) {
            JOptionPane.showMessageDialog(null, "password is same!");
        }
        UC_ModUserM uc_mum = new UC_ModUserM(userid,password);
        return uc_mum.modify();
    }
}
